#ifndef SKETCHMODEL_H
#define SKETCHMODEL_H

#include <vector>
#include <iostream>
#include <QMetaType>

#include "Sketch.h"
#include "RenderAgentInterface.h"

using namespace std;

/**
 *  A SketchModel is a collection of CSketch objects that represents
 *  the users complete 2D creation.
 */
class SketchModel
{
public:
	SketchModel(void);
	SketchModel(RenderAgentInterface *renderAgent, int area_width, int area_height);
	virtual ~SketchModel(void);
	
	void addSketch(CSketch *sketch);// Adds another CSketch to this SketchModel
	void removeSketch();			// Remove last CSketch added to this SketchModel
	void clearSketches();

	void render2D();				// Draw the CSketches
	void renderSketchInProgress(int numPixels, int pixels[][2]); // Draw the sketch in progress
	void render3D();
	void initialize3D();

	void set2dRenderMode(RenderModeType renderMode)		   { this->renderMode  = renderMode;  }
	void setRenderAgent(RenderAgentInterface *renderAgent) { this->renderAgent = renderAgent; }

	int   getHeight();
	float getUnitHeight();

private:
	// Renderer object to render the SketchModel
	RenderAgentInterface *renderAgent;

	RenderModeType renderMode;

	vector<CSketch*> sketches; // Contains all of the CSketches in the SketchModel

	int   rawHeight;
	float unitHeight;

	int sketch_area_width;  // Width  of the sketch area the sketch was drawn in
	int sketch_area_height; // Height of the sketch area the sketch was drawn in

	void sketchModelChanged();
	void updateHeight();
};

Q_DECLARE_METATYPE(SketchModel);

#endif
